package com.lucenly.spell.fragment

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.lucenly.spell.R
import com.lucenly.spell.adapter.HomeItemAdapter
import com.lucenly.spell.adapter.TypeItemAdapter
import com.lucenly.spell.adapter.TypeTabAdapter
import com.lucenly.spell.base.BaseFragment
import com.lucenly.spell.databinding.FragmentTypeBinding

class TypeFragment : BaseFragment<FragmentTypeBinding>(R.layout.fragment_type) {
    val tabs = arrayListOf<String>("美妆个护","食品饮料","日用百货","服饰鞋包","生鲜冷链","户外运动","3C大家电","首饰珠宝","母婴生活","美妆个护","食品饮料","日用百货","服饰鞋包","生鲜冷链")
    override fun getViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): FragmentTypeBinding {
        return FragmentTypeBinding.inflate(inflater)
    }

    override fun initData() {
        binding.tab.layoutManager = LinearLayoutManager(context)
        val adapter = TypeTabAdapter(
           tabs,context!!
        )
        binding.tab.adapter = adapter
        var list = arrayListOf<Int>()
        for (i in 1..10){
            list.add(i)
        }
//        binding.content.setBackgroundColor(color)
        binding.recyclerView.layoutManager = LinearLayoutManager(context)
        val typeItemAdapter = TypeItemAdapter(list, context!!)
        binding.recyclerView.adapter = typeItemAdapter
    }

    override fun initEvent() {
    }

    override fun startObserve() {
    }
}